﻿<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" autoFlush="true"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="/WEB-INF/qa-category.tld" prefix="cat"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<logic:present name="questiono">
<div style="padding:0 0 6 0;">
    <html:link page="/question.mrqa?action=list&catId=18">网站公告</html:link><cat:catlinks objType="Q"/>
</div>
<div style="background-color:#FAFCFC;width:720;padding:4px 4px 4px 4px;border:1px solid #ccc;">
<table border="0" cellpadding="0" cellspacing="0" style="width:710;word-wrap:break-word;table-layout:fixed;">
    <tr>
        <td align="left" height="40">
            <b>
            	<c:if test="${questiono.titleAttribute != null}">
            		<span style="<c:out value="${questiono.titleAttribute}" />">
            	</c:if>
            	<c:out value="${questiono.title}" escapeXml="false"/>
            	<c:if test="${questiono.titleAttribute != null}">
            		</span>
            	</c:if>
            </b><br>
            <fmt:formatDate value="${questiono.postDate}" var="postDate" type="both" pattern="yyyy-MM-dd HH:mm:ss"/>
            发布时间: <c:out value="${postDate}"/>
        </td>
    </tr>    
    <tr>
        <td style="background-color:#FAFCFC;">
        <pre style="white-space: pre-wrap;"><c:out escapeXml="false" value="${fn:replace(questiono.content,'<image=','<img name=contentimg border=0 src=')}"/></pre>
        </td>
    </tr> 
    <tr>
        <td>
            <p>
            <logic:notEmpty property="reference" name="questiono">
                参考:<a href="<bean:write property="reference" name="questiono"/>" target="_blank"><bean:write property="reference" name="questiono"/></a><br>
            </logic:notEmpty>
            <logic:notEmpty property="fileName" name="questiono">
                附件:
                <c:set var="ufid" value="q${questiono.id}"/>
                <html:link page="/download.mrqa" paramId="id" paramName="ufid">
                    <c:out value="${questiono.fileName}"/>
                </html:link>                    
                (请谨慎判断文件类型,避免恶意侵扰,网站不负责可能造成的损坏或损失)
            </logic:notEmpty>
            </p>
        </td>
    </tr>
    <logic:present name="user_session" scope="session">
    <tr>
        <td>
        <c:if test="${user_session.type == '1'}">
                    <p>
                        <logic:notEqual value="4" name="questiono" property="state">
                            <html:link page="/question.mrqa?action=close" paramId="id" paramName="questiono" paramProperty="id" title="隐藏此帖子,避免别的用户看到（仅作者能看到此连接）,你也可以在<用户中心>重新打开此帖子">
                            隐藏
                            </html:link>
                        </logic:notEqual>
                        <logic:equal value="4" name="questiono" property="state">
                            <html:link page="/question.mrqa?action=reopen" paramId="id" paramName="questiono" paramProperty="id" title="打开此帖子,使别的用户看到（仅作者能看到此连接）,你也可以在<用户中心>重新隐藏此帖子;">
                            打开
                            </html:link>
                        </logic:equal>
                        |
                        <html:link page="/question.mrqa?action=delete" paramId="id" paramName="questiono" paramProperty="id" title="帖子被彻底删除,不能恢复">
                            删除
                        </html:link>
                    </p>
       </c:if>
       </td>
      </tr>
    </logic:present>    
</table>
</div>
<br>
<c:if test="${user_session.type == '1'}">
<table class="mars" cellpadding="0" cellspacing="0">
    <html:form action="/question" method="post" enctype="multipart/form-data" onsubmit="return validate(this);">
    <html:hidden property="action" value="modify"/>
    <input type="hidden" name="catId" value="<c:out value="${questiono.mrIaskCategory.id}"/>"/>
    <input type="hidden" name="id" value="<c:out value="${questiono.id}"/>"/>
    <tr class="even">
        <td colspan="2" align="left"><b>修改信息</b></td>
    </tr>
    <tr>
        <td align="right">标题</td>
        <td>
            <html:text property="title" name="questiono" size="100" maxlength="60"/>*<br>
            	颜色：<html:radio property="titleColor" value="0">无</html:radio>
            	<html:radio property="titleColor" value="1">红</html:radio>
            	<html:radio property="titleColor" value="2">蓝</html:radio>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            	<html:checkbox property="titleIsBold">粗体</html:checkbox>
        </td>
    </tr> 
    <tr  class="even">
        <td align="right">内容</td>
        <td>
            <textarea name="content" cols="80" rows="10"><c:out value="${questiono.content}" escapeXml="true"/></textarea>
        </td>
    </tr>
    <tr>
        <td align="right">参考</td>
        <td>
            <html:text property="reference" name="questiono" size="100"/>
        </td>
    </tr>
   <tr class="even">
        <td align="right">附件</td>
        <td>
            <logic:notEmpty property="fileName" name="questiono">
                原附件:
                <c:set var="ufid" value="q${questiono.id}"/>
                <html:link page="/download.mrqa" paramId="id" paramName="ufid">
                    <c:out value="${questiono.fileName}"/>
                </html:link>
                &nbsp;&nbsp;
                <html:link page="/question.mrqa?action=deletefile" paramId="id" paramName="questiono" paramProperty="id">
                        删除
                </html:link>
                <br>
            </logic:notEmpty>
            <html:file property="file" size="100"/><br>(如果重新上载，原文件被删除)
        </td>
    </tr>
    <tr class="even">
        <td align="right"></td>
        <td>
            <input type="submit" value="保存修改"/>
        </td>
    </tr>
    </html:form>
</table>
</c:if>
</logic:present>